//
//  LSZMVSongCollectionViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/9/5.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZMVSongCollectionViewCell.h"
#import "LSZMVSongCollectionViewCell+LCUpdateConstraints.h"

@implementation LSZMVSongCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
        [self lcSetupConstraints];
    }
    return self;
}

-(void)setupUI {
        CGFloat width = (ScreenWidth - 30-1) /2;

        self.imageViewCover = [[UIImageView alloc]init];
        self.imageViewCover.frame = CGRectMake(0, 0, width, width/3*2);
        [self addSubview:self.imageViewCover];
        CGFloat height = [LSZSpecialPackaging initWithReturnsthesizeOf:18 :2];

        self.labelHits = [[UILabel alloc]init];
        self.labelHits.frame = CGRectMake(10, 10 , self.imageViewCover.frame.size.width-10, height);
        self.labelHits.textAlignment = NSTextAlignmentRight;
        self.labelHits.textColor = [UIColor whiteColor];
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelHits font:14];
        [self.imageViewCover addSubview:self.labelHits];

        self.imageViewHits = [[UIImageView alloc]init];
        self.imageViewHits.frame = CGRectMake(10, 12.5, 15, 15);
        self.imageViewHits.image = [UIImage imageNamed:@"白耳机"];
        [self.imageViewCover addSubview:self.imageViewHits];


        self.imageViewPlay = [[UIImageView alloc]init];
        self.imageViewPlay.image = [UIImage imageNamed:@"装饰_播放"];
        self.imageViewPlay.frame = CGRectMake((self.imageViewCover.frame.size.width-25)/2, (self.imageViewCover.frame.size.height-25)/2, 25, 25);
        [self.imageViewCover addSubview:self.imageViewPlay];

        CGFloat heightTime = [LSZSpecialPackaging initWithReturnsthesizeOf:14 :2];
        self.labelTime = [[UILabel alloc]init];
        self.labelTime.textColor = [UIColor whiteColor];
        self.labelTime.frame = CGRectMake(10, self.imageViewCover.frame.size.height-5-heightTime, self.imageViewCover.frame.size.width-20, heightTime);
        self.labelTime.textAlignment = NSTextAlignmentRight;
        [LSZSpecialPackaging setAnySizeLabel:self.labelTime :12.5];
        [self.imageViewCover addSubview:self.labelTime];
    self.albumHaveSongsNum = [[UILabel alloc]init];
    self.albumHaveSongsNum.hidden = true;
    self.albumHaveSongsNum.textColor = [UIColor whiteColor];
    self.albumHaveSongsNum.frame = CGRectMake(10, self.imageViewCover.frame.size.height-5-heightTime, self.imageViewCover.frame.size.width-20, heightTime);
    self.albumHaveSongsNum.textAlignment = NSTextAlignmentRight;
    [LSZSpecialPackaging setAnySizeLabel:self.albumHaveSongsNum :12.5];
    [self.imageViewCover addSubview:self.albumHaveSongsNum];

        self.imageViewTimePlayer = [[UIImageView alloc]init];
        self.imageViewTimePlayer.frame = CGRectMake(10, self.imageViewCover.frame.size.height-5-heightTime, 12, 12);
        self.imageViewTimePlayer.image = [UIImage imageNamed:@"时长音符"];
        [self.imageViewCover addSubview:self.imageViewTimePlayer];


        self.imageViewRightPlay = [[UIImageView alloc]init];
        self.imageViewRightPlay.image = [UIImage imageNamed:@"播放器-播放"];
        self.imageViewRightPlay.frame = CGRectMake(self.imageViewCover.frame.size.width-10-heightTime, self.imageViewCover.frame.size.height-10-heightTime, heightTime+5, heightTime+5);
        self.imageViewRightPlay.hidden = YES;
        [self.imageViewCover addSubview:self.imageViewRightPlay];



        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.frame = CGRectMake(10, CGRectGetMaxY(self.imageViewCover.frame)+10, width-20, height);
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelTitle font:15];
        self.labelTitle.textColor = titleColorLSZ;
        [self addSubview:self.labelTitle];

        CGFloat heightNote = [LSZSpecialPackaging initWithReturnsthesizeOf:16 :2];
        self.labelNote = [[UILabel alloc]init];
//        self.labelNote.numberOfLines = 2;
        self.labelNote.frame = CGRectMake(10, CGRectGetMaxY(self.labelTitle.frame)+5, width-20, heightNote);
        self.labelNote.textColor = lightColor;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelNote font:14];
        [self addSubview:self.labelNote];

}
-(void)setListOfMVTypesMg:(LSZListOfMVTypesMg *)ListOfMVTypesMg
{
    NSLog(@"ListOfMVTypesMg.cover_url = %@", ListOfMVTypesMg.cover_url);
    [self.imageViewCover sd_setImageWithURL:[NSURL URLWithString:ListOfMVTypesMg.cover_url] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    self.labelTitle.text = ListOfMVTypesMg.name;
    self.labelNote.text = ListOfMVTypesMg.artist_name;
}
@end
